public Class MainWrapperClass
{
public string Differentobject{get;set;}
public String Accname{get;set;}
public String Conname{get;set;}
public String AccountName='';
public String ContactName='';
public id id1='0019000000Cd9lLAAR';
public id id2='0039000000DNmUS';

public WrapperClass getDifferentObject()
{
Account Varacc=[Select id,name from Account where id=:id1];

AccountName=Varacc.name;
wrapperClass Wc=new wrapperClass(AccountName,ContactName);
return wc;
}

public PageReference contacts()
{

List<Contact> Varcon=[Select Accountid,lastname from Contact where Accountid in(select id from account where id=:id1)];

if(!Varcon.isEmpty())
{

for(Contact cnt: Varcon)
//for(Integer i=0;i<=1;i++)
{
if(cnt.Lastname!=null)
{
ContactName+=cnt.Lastname+',';
}
}
}

return null;
}
public Class wrapperClass
{
public String Accname{get;set;}
public String Conname{get;set;}
public wrapperClass(String Aname,String Cname)
{
Accname=Aname;
Conname=Cname;
}
}


}